package com.ruoyi.lab.controller;

import com.ruoyi.lab.utils.MyTool;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.lab.domain.JacTestResult;
import com.ruoyi.lab.service.IJacTestResultService;

import java.util.*;

/**
 * test 提供者
 *
 * @author ruoyi
 * @date 2021-04-06
 */
@RestController
@RequestMapping("result")
public class JacTestResultController extends MyTool
{

	@Autowired
	private IJacTestResultService jacTestResultService;

	/**
	 * 查询${tableComment}
	 */
	@GetMapping("get/{code}")
	public Object get(@PathVariable("code") Long code)
	{    HashMap<String,Object> result=new HashMap<>();

		result.put("datas", jacTestResultService.selectJacTestResultById(code));
		result.put("msg", "success");
		result.put("code", "0");
		return result;

	}

	/**
	 * 查询test列表
	 */
	@GetMapping("list")
	public  Map<String, Object>  list(JacTestResult jacTestResult)
	{
		startPage();
		return jacTestResultService.selectJacTestResultList(jacTestResult);
	}


	/**
	 * 新增保存test
	 */
	@PostMapping("save")
	public Map<String, String> addSave(@RequestBody JacTestResult jacTestResult)
	{
		return jacResultMsg(jacTestResultService.insertJacTestResult(jacTestResult));
	}
/*
    @PostMapping("upload")
	{
		return
	}
*/

	/**
	 * 修改保存test
	 */
	@PostMapping("update")
	public R editSave(@RequestBody JacTestResult jacTestResult)
	{
		return toAjax(jacTestResultService.updateJacTestResult(jacTestResult));
	}

	/**
	 * 删除${tableComment}
	 */
	@PostMapping("remove")
	public R remove(String ids)
	{
		return toAjax(jacTestResultService.deleteJacTestResultByIds(ids));
	}

}

